package com.nidu.demo.log;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.nidu.demo.log.api.SysApiAccessLogService;
import com.nidu.demo.log.dto.*;
import com.nidu.demo.log.executor.command.ApiAccessLogDeleteCmdExe;
import com.nidu.demo.log.executor.query.*;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Set;

/**
 * API访问日志服务实现类
 *
 * @author auto
 */
@Service
@RequiredArgsConstructor
public class SysApiAccessLogServiceImpl implements SysApiAccessLogService {

    private final ApiAccessLogSingleQryExe singleQryExe;
    private final ApiAccessLogPageQryExe pageQryExe;
    private final ApiAccessLogDeleteCmdExe deleteCmdExe;

    @Override
    public SingleResponse<ApiAccessLogCO> getById(Long id) {
        return singleQryExe.execute(id);
    }

    @Override
    public PageResponse<ApiAccessLogCO> page(ApiAccessLogPageQry qry) {
        return pageQryExe.execute(qry);
    }

    @Override
    public Response delete(Long id) {
        return deleteCmdExe.execute(id);
    }

    @Override
    public Response delete(Set<Long> ids) {
        return deleteCmdExe.execute(ids);
    }

    @Override
    public Response clear() {
        return deleteCmdExe.execute();
    }

    @Override
    public Response export(ApiAccessLogPageQry qry) {
        return null;
    }

    @Override
    public Response getStatistics() {
        return null;
    }

}
